/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import model.ExperimentadosMODEL;

/**
 *
 * @author Welisson
 */
public class ExperimentadosDAO extends GenericDAO{
    
    private static final String COUNT = "select count(*) from experimentados where "
            + "cal_id = ? AND exp_cat = ? AND exp_cor = ? AND exp_de = ? AND exp_ate = ?;";
    
    public int countExperimentados(ExperimentadosMODEL exp) throws SQLException{
        
        PreparedStatement ps = conn.prepareStatement(COUNT);
        ps.setInt(1, exp.getCalcado());
        ps.setString(2, exp.getCategoria());
        ps.setString(3, exp.getCor());
        ps.setInt(4, exp.getDe());
        ps.setInt(5, exp.getAte());
        
        ResultSet rs = ps.executeQuery();
        
        while(rs.next()){
            return rs.getInt("count");
        }
        return 0;
        
    }
    
}
